Repository navigation
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-10-08T16:31:12.602809+00:00 ✅ All Tests Passed!116/116 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 7, 2026 02:03
891b4c8 to
a515200
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-config
branch
from
October 7, 2026 02:03
0ae6eb7 to
8da410d
Compare
3 of 5 tasks
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 7, 2026 17:43
a515200 to
ea1d279
Compare
Contributor
Author
|
@greptileai review |
eli-r-ph
marked this pull request as ready for review
October 7, 2026 20:43
dustinbyrne
reviewed
Oct 7, 2026
| uuid: Optional[Union[str, UUID]] = None, | ||
| disable_geoip: Optional[bool] = None, | ||
| distinct_id: Optional[ID_TYPES] = None, | ||
| options: Optional[Dict[str, Any]] = None, |
Contributor
There was a problem hiding this comment.
worth using stronger types? e.g.
class CaptureOptions(TypedDict, total=False):
cookieless_mode: Optional[bool]
disable_skew_correction: Optional[bool]
process_person_profile: Optional[bool]
Contributor
Author
There was a problem hiding this comment.
🤔 good callout I considered this - as long as no SDK code changes are needed for future options once we define them, the solution does what we want 👍
I rejected TypedDict here so far for two reasons:
- the backend does a curated lenient parse on these values for "boolean-intent" that will shore up some current silent fails in legacy capture, that will now apply uniformly across v1 SDKs; with
TypedDict, legacy hoisted props would fail hard on non-boolvalues just on this SDK, or we'd need to dup the backend parsing then keep it in parity w/capture - I think as we add future options to
TypedDictthat aren't in the schema,mypyand friends might flag end user call sites that apply them with warnings?
If I'm missing something let me know, happy to adjust, but I'm leaning towards keeping this as is for those reasons?
eli-r-ph
force-pushed
the
v1-capture-options
branch
from
October 8, 2026 16:25
ea1d279 to
9705c81
Compare
eli-r-ph
force-pushed
the
v1-capture-ai-config
branch
from
October 8, 2026 16:25
ba59e9d to
44d141d
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Capture v1 sends processing options (
process_person_profile,cookieless_mode,disable_skew_correction,product_tour_id) in a per-eventoptionsobject. Until now the SDK only filled it from legacy$properties, coerced the values, and gave callers no way to set options directly. posthog-go and posthog-rsv1already take per-event options and send them as given.New
optionsargument oncapture,capture_ai,set,set_once,group_identify,aliasandcapture_exception, onClient,AsyncPosthogand the module-level functions. For example:posthog.capture("signed_up", distinct_id=..., options={"cookieless_mode": True}).Behavior changes:
$cookieless_mode,$ignore_sent_at,$product_tour_idand$process_person_profilestill fill the matching option, unchanged. Before,"true"becameTrueand an unparseable value was dropped. The property is always removed fromproperties.nulloption counts as unset, so the property fills it. This matches go and rs.before_send. That was already the case.before_sendnow also seesoptionsand can change it.{...}braced andurn:uuid:in any case; each is canonicalizeduuid:prefix or misplaced hyphens, is replaced with a generated uuid and loggedAsyncPosthogtoo, which before accepted anythinguuid.UUID()parses$feature_flag_calledevents keep$cookieless_mode,$ignore_sent_at,$product_tour_idand$window_id. The allowlist runs before the legacy properties move into options, so these were dropped and their options lost. posthog-go has the same fix in feat!: add default and request-context options; event values win over defaults posthog-go#359.Not in this PR: global and context options, the layer-order change, and the personless option (next PR in the stack), and AI wrappers and MCP moving to options (the one after).
💚 How did you test it?
test_event_options.py. It checks thatoptionsreaches the wire from every method onClientandAsyncPosthog. Abefore_sendthat returns a new event can change options and remove a legacy property. A non-dictoptionsis logged and the event is still sent.window_id.aliasdropping optionspython -W error -c "import posthog", the public API snapshot anduv lock --check.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileCovered by the existing
capture-v1-majorchangeset; the migration guide lands later in this stack.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Written with Cursor (Claude Opus) under the direction of the assignee.
Agreed before implementation:
optionslogged and ignored$session_id/$window_idmove to top-level fieldsbefore_senduuid.ValidateAgent calls worth review:
options(maybe{}), sobefore_sendsees the keynulllegacy property still fills an unset option asnull, as in posthog-rs